<template>
  <div id="app">
    <MyHeader title="购物车案例" />
    <MyGoods v-for="item in list"
             :key="item.id"
             :goods="item" />
    <MyFooter :arr="list" />
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader.vue"
import MyGoods from "./components/MyGoods.vue"
import MyFooter from "./components/MyFooter.vue"
export default {
  data () {
    return {
      list: []
    }
  },
  components: {
    MyHeader,
    MyFooter,
    MyGoods
  },
  async created () {
    let res = await this.$axios({
      url: "/api/cart"
    })
    this.list = res.data.list
  },

  methods: {

  }
}
</script>

<style scoped>
#app {
  padding: 45px 0;
}
</style>
